using System;
using DayPilot.Utils;

public partial class Scheduler_Year : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // starting first day of the first week (using ISO 8601, i.e. week starts on Monday)
        DayPilotScheduler1.StartDate = Week.FirstDayOfWeek(new DateTime(2010, 1, 1), DayOfWeek.Monday);

        // ending at the end of the last week
        DayPilotScheduler1.Days = (int) (Week.FirstDayOfWeek(new DateTime(2011, 1, 1)).AddDays(7) - DayPilotScheduler1.StartDate).TotalDays;

        if (!IsPostBack)
        {
            if (Session["ResourcesView"] == null)
                Session["ResourcesView"] = DataGenerator.GetData();

            DayPilotScheduler1.DataSource = Session["ResourcesView"];
            DayPilotScheduler1.SetScrollX(DateTime.Today);
            DataBind();
        }
    }

    protected void DayPilotScheduler1_BeforeTimeHeaderRender(object sender, DayPilot.Web.Ui.Events.BeforeTimeHeaderRenderEventArgs e)
    {
        if (!e.IsColGroup)
        {
            e.InnerHTML = Week.WeekNrISO8601(e.Start).ToString();
        }

    }
}
